<template>
  <div class="mylogin">
    <div class="type">
      <span class="iconfont" @click="goto()">&#xe779;</span>
      长源灯饰
    </div>
    <div class="login">
      <div>
        <input
          v-model="name"
          type="text"
          name="name"
          placeholder="请输入账号"
        />
        <input
          v-model="pass"
          type="password"
          name="password"
          placeholder="请输入密码"
        />
      </div>
      <button @click="login()">注册 / 登录</button>
    </div>
    <div class="bag bg-blur"></div>
  </div>
</template>
<style lang="scss" scoped>
.type {
  text-align: center;
  line-height: 50px;
  font-size: 16px;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 9999;
  border-bottom: 1px solid #ccc;
  font-weight: bold;
  color: rgb(116, 116, 116);
  text-align: center;
  background-color: white;
  span {
    position: absolute;
    display: block;
    height: 50px;
    width: 40px;
  }
  > a {
    display: block;
    > span {
      position: absolute;
      display: block;
      height: 50px;
      color: rgb(116, 116, 116);
      font-size: 25px;
      width: 40px;
      right: 0;
      top: 0;
    }
  }
}
.mylogin {
  height: 100%;
  overflow: hidden;
}
.bag {
  height: 100%;
  background-image: url("../assets/back.png");
  background-size: 100% 100%;
  position: relative;
  z-index: -1;
  margin-top: -220px;
}
.bg-blur {
  float: left;
  width: 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  -webkit-filter: blur(10px);
  -moz-filter: blur(10px);
  -o-filter: blur(10px);
  -ms-filter: blur(10px);
  filter: blur(10px);
}
.login {
  margin-top: 100px;
  height: 120px;
  width: 100%;
  div {
    display: flex;
    flex-direction: column;
    width: 90%;
    margin: 0 auto;
    input {
      border-radius: 10px 10px 0 0;
      font-size: 20px;
      border: none;
      outline-style: none;
      line-height: 50px;
      color: rgb(66, 66, 66);
      padding: 0 20px;
    }
    input:nth-child(2) {
      border-radius: 0 0 10px 10px;
    }
  }
  button {
    display: block;
    width: 90%;
    line-height: 50px;
    margin: 10px auto;
    border: none;
    border-radius: 8px;
    background-color: red;
    color: white;
    font-size: 18px;
  }
}
</style>
<script>
import { mapState } from "vuex";
export default {
  data() {
    return {
        name:'',
        pass:''
    };
  },
  methods: {
    goto() {
      this.$router.go(-1);
    },
    login() {
      if(this.name.length<=2){
          alert('账号长度不能少于3个字符')
      }else if(this.pass.length<6){
          alert('密码长度不能少于6个字符')
      }else{
        this.$store.state.denglu=true;
            this.$router.push({ path: "/home/index",});
      }
    },
  },
  computed: {
    ...mapState(["img", "sp", "kx"]),
  },
};
</script>